import requests
import config
# 创建接口类
class DeptAPI:
    # 获取部门
    def huoqu(self,token):
        url = f"{config.BASE_URL}/api/company/department"
        return requests.get(url=url,headers={"Authorization":token})
    # 查询部门
    def chaxun(self,token,data_id):
        url = f"{config.BASE_URL}/api/company/department{data_id}"
        return requests.post(url=url,headers={"Authorization":token},)
    # 添加部门
    def tianjia(self,token,body_aed,data_id):
        url = f"{config.BASE_URL}/api/company/department{data_id}"
        return requests.post(url=url,headers={"Authorization":token},json=body_aed)

    # 修改部门
    def xiugai(self,token,body_aed,data_id):
        url = f"{config.BASE_URL}/api/company/department{data_id}"
        return requests.put(url=url, headers={"Authorization": token}, json=body_aed)

    # 删除部门
    def shanchu(self,token,data_id):
        url = f"{config.BASE_URL}/api/company/department{data_id}"
        return requests.delete(url=url, headers={"Authorization": token})
